package acwing._2LanQiao._6DoublePointer_BFS_Graph;
/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._6DoublePointer_BFS_Graph
 * @File : Q1240.java
 * @Author : WangRuoyu
 * @Date : 2023/3/19 14:51
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q1240 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        int n = Integer.parseInt(words[0]);
        words = br.readLine().split(" ");

        int layer = 0;
        long maxsum = Long.MIN_VALUE;
        int i = 0;
        int j = 0;

        for (i = 1; ((1 << i) - 1) <= n; ++i) {
            long sum = 0;
            for (j = 1 << (i - 1); j <= (1 << i) - 1; ++j) {
                sum += Integer.parseInt(words[j - 1]);
            }
            if (sum > maxsum) {
                maxsum = sum;
                layer = i;
            }
        }
        long sum = 0;
        while (j <= n) {
            sum += Integer.parseInt(words[j - 1]);
            j++;
        }
        if (sum > maxsum) {
            maxsum = sum;
            layer = i;
        }

        System.out.println(layer);
    }
}
